package my.poemhelper.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import my.poemhelper.vo.Words;

@Component
public class WordsDaoImpl implements WordsDao {

	@Autowired
	private JdbcTemplate jdbcTemplate;
	@Override
	public void insertWords(Words w) {
		String sql = "insert into words(words,meaning)value('"+w.getWords()+"','"+w.getInfo()+"')";
		jdbcTemplate.execute(sql);
	}
	@Override
	public int getWordsCount() {
		String sql = "select count(1) from words";
		int r = jdbcTemplate.queryForInt(sql);
		return r;
	}

}
